#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(void)
{
	int i, p;
	int num, tnum, revnum;
	int cnt = 0;

	srand(time(NULL));

	for (i = 0; i < 10; i++) {
		tnum = num = rand() % 1000;
		revnum = 0;
			
		while (tnum) {
			revnum = revnum * 10 + tnum % 10;
			tnum /= 10;
		}

		if (revnum == num) {
			printf("%d是对称数 %d\n", num, revnum);
			cnt++;
		} else {
			printf("%d不是对称数 %d\n", num, revnum);
		}
	}

	printf("共有%d个对称数\n", cnt);
}
